package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.DbWelfareMapper;
import com.ruoyi.system.domain.DbWelfare;
import com.ruoyi.system.service.IDbWelfareService;

/**
 * 公益活动Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-03-22
 */
@Service
public class DbWelfareServiceImpl implements IDbWelfareService 
{
    @Autowired
    private DbWelfareMapper dbWelfareMapper;

    /**
     * 查询公益活动
     * 
     * @param id 公益活动主键
     * @return 公益活动
     */
    @Override
    public DbWelfare selectDbWelfareById(Long id)
    {
        return dbWelfareMapper.selectDbWelfareById(id);
    }

    /**
     * 查询公益活动列表
     * 
     * @param dbWelfare 公益活动
     * @return 公益活动
     */
    @Override
    public List<DbWelfare> selectDbWelfareList(DbWelfare dbWelfare)
    {
        return dbWelfareMapper.selectDbWelfareList(dbWelfare);
    }

    /**
     * 新增公益活动
     * 
     * @param dbWelfare 公益活动
     * @return 结果
     */
    @Override
    public int insertDbWelfare(DbWelfare dbWelfare)
    {
        dbWelfare.setCreateTime(DateUtils.getNowDate());
        return dbWelfareMapper.insertDbWelfare(dbWelfare);
    }

    /**
     * 修改公益活动
     * 
     * @param dbWelfare 公益活动
     * @return 结果
     */
    @Override
    public int updateDbWelfare(DbWelfare dbWelfare)
    {
        dbWelfare.setUpdateTime(DateUtils.getNowDate());
        return dbWelfareMapper.updateDbWelfare(dbWelfare);
    }

    /**
     * 批量删除公益活动
     * 
     * @param ids 需要删除的公益活动主键
     * @return 结果
     */
    @Override
    public int deleteDbWelfareByIds(Long[] ids)
    {
        return dbWelfareMapper.deleteDbWelfareByIds(ids);
    }

    /**
     * 删除公益活动信息
     * 
     * @param id 公益活动主键
     * @return 结果
     */
    @Override
    public int deleteDbWelfareById(Long id)
    {
        return dbWelfareMapper.deleteDbWelfareById(id);
    }
}
